home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Games / Pararena 1.3 / source / Parts ƒ / GameBody.p < prev    next >
Encoding:
Text File  |  1991-05-17  |  15.3 KB  |  709 lines  |  [TEXT/PJMM]

  1. program Pararena;
  2.  
  3.     uses
  4.         LogoWindo, Sound, Globals, Unlock, Dialogs, Utilities, Guts, Initialize, TheMenus;
  5.     var
  6.         eventHappened: Boolean;
  7.         tempInt: Integer;
  8.  
  9. {________________________________}
  10.  
  11.     procedure WriteOutScores;
  12.  
  13.         type
  14.             scoreHandle = ^scorePtr;
  15.             scorePtr = ^score;
  16.             score = record
  17.                     data: array[0..47] of Integer;
  18.                 end;
  19.  
  20.             nameHandle = ^namePtr;
  21.             namePtr = ^name;
  22.             name = record
  23.                     data: array[0..11, 0..14] of Char;
  24.                 end;
  25.  
  26.             prefHandle = ^prefPtr;
  27.             prefPtr = ^pref;
  28.             pref = record
  29.                     data: array[0..24] of Char;
  30.                 end;
  31.  
  32.             gamePrefs = record
  33.                     isLocked, isSoundOn: Boolean;
  34.                     isSoundArray: array[1..5] of Boolean;
  35.                     whenToLock, isDelayTime: Integer;
  36.                 end;
  37.             gamePrefsPtr = ^gamePrefs;
  38.             gamePrefsHand = ^gamePrefsPtr;
  39.  
  40.         var
  41.             index, index2, i: integer;
  42.             theScores: scoreHandle;
  43.             theNamesGreat, theNamesDelta: nameHandle;
  44.             thePrefs: prefHandle;
  45.             theGamePrefs: gamePrefsHand;
  46.  
  47.     begin
  48.         thePrefs := prefHandle(NewHandle(SIZEOF(pref)));
  49.         HLock(Handle(thePrefs));
  50.         Handle(thePrefs) := GetResource('pref', 128);
  51.         for index := 0 to 24 do
  52.             thePrefs^^.data[index] := COPY(prefsStr, index + 1, 1);
  53.         ChangedResource(Handle(thePrefs));
  54.         WriteResource(Handle(thePrefs));
  55.         HUnlock(Handle(thePrefs));
  56.  
  57.         theGamePrefs := gamePrefsHand(NewHandle(SIZEOF(gamePrefs)));
  58.         Handle(theGamePrefs) := GetResource('pref', 129);
  59.         HLock(Handle(theGamePrefs));
  60.         with theGamePrefs^^ do
  61.             begin
  62.                 isSoundOn := soundOn;
  63.                 for i := 1 to 5 do
  64.                     isSoundArray[i] := soundArray[i];
  65.                 isLocked := locked;
  66.                 whenToLock := timeToLock;
  67.                 isDelayTime := delayTime;
  68.             end;
  69.         ChangedResource(Handle(theGamePrefs));
  70.         WriteResource(Handle(theGamePrefs));
  71.         HUnlock(Handle(theGamePrefs));
  72.  
  73.         if (scoresChanged) then
  74.             begin
  75.                 theScores := scoreHandle(NewHandle(SIZEOF(score)));
  76.                 MoveHHi(Handle(theScores));
  77.                 HLock(Handle(theScores));
  78.                 Handle(theScores) := GetResource('scrs', 128);
  79.                 with hiScores do
  80.                     for index := 0 to 11 do
  81.                         begin
  82.                             theScores^^.data[index] := greatScores[index, 0];
  83.                             theScores^^.data[index + 12] := greatScores[index, 1];
  84.                             theScores^^.data[index + 24] := deltaScores[index, 0];
  85.                             theScores^^.data[index + 36] := deltaScores[index, 1];
  86.                         end;
  87.                 ChangedResource(Handle(theScores));
  88.                 WriteResource(Handle(theScores));
  89.                 HUnlock(Handle(theScores));
  90.  
  91.                 theNamesGreat := nameHandle(NewHandle(SIZEOF(name)));
  92.                 HLock(Handle(theNamesGreat));
  93.                 Handle(theNamesGreat) := GetResource('name', 128);
  94.                 with hiScores do
  95.                     for index := 0 to 11 do
  96.                         for index2 := 0 to 14 do
  97.                             theNamesGreat^^.data[index, index2] := COPY(greatNames[index], index2 + 1, 1);
  98.                 ChangedResource(Handle(theNamesGreat));
  99.                 WriteResource(Handle(theNamesGreat));
  100.                 HUnlock(Handle(theNamesGreat));
  101.  
  102.                 theNamesDelta := nameHandle(NewHandle(SIZEOF(name)));
  103.                 HLock(Handle(theNamesDelta));
  104.                 Handle(theNamesDelta) := GetResource('name', 129);
  105.                 with hiScores do
  106.                     for index := 0 to 11 do
  107.                         for index2 := 0 to 14 do
  108.                             theNamesDelta^^.data[index, index2] := COPY(deltaNames[index], index2 + 1, 1);
  109.                 ChangedResource(Handle(theNamesDelta));
  110.                 WriteResource(Handle(theNamesDelta));
  111.                 HUnlock(Handle(theNamesDelta));
  112.             end;
  113.     end;
  114.  
  115. {________________________________}
  116.  
  117.     function AbortGame: Boolean;
  118.         var
  119.             dummyInt: Integer;
  120.             line1, line2: Str255;
  121.             alertHandle: AlertTHndl;
  122.             alertRect: Rect;
  123.     begin
  124.         AbortGame := FALSE;
  125.         InitCursor;
  126.  
  127.         alertHandle := AlertTHndl(Get1Resource('ALRT', yesNoAlertID));
  128.         if (alertHandle <> nil) then
  129.             begin
  130.                 HNoPurge(Handle(alertHandle));
  131.                 alertRect := alertHandle^^.boundsRect;
  132.                 OffsetRect(alertRect, -alertRect.left, -alertRect.top);
  133.                 dummyInt := (screenBits.bounds.right - alertRect.right) div 2;
  134.                 OffsetRect(alertRect, dummyInt, 0);
  135.                 dummyInt := (screenBits.bounds.bottom - alertRect.bottom) div 3;
  136.                 OffsetRect(alertRect, 0, dummyInt);
  137.                 alertHandle^^.boundsRect := alertRect;
  138.                 HPurge(Handle(alertHandle));
  139.             end;
  140.         dummyInt := Alert(yesNoAlertID, nil);
  141.         if (dummyInt = 1) then
  142.             AbortGame := TRUE;
  143.     end;
  144.  
  145. {________________________________}
  146.  
  147.     procedure ReturnToGame;
  148.     begin
  149.         if (not cursorVis) then
  150.             HideCursor;
  151.         CopyBits(offVirginMap, mainWndo^.portBits, wholeScreen, wholeScreen, srcCopy, wholeRgn);
  152.     end;
  153.  
  154. {________________________________}
  155.  
  156.     procedure DoOpeningAnimation;
  157.         var
  158.             index, lift, tempInt: Integer;
  159.     begin
  160.         SetPort(mainWndo);
  161.         tileLit := tileLit + 1;
  162.         if (tileLit > 5) then
  163.             begin
  164.                 tileLit := 0;
  165.                 tileToggle := 1 - tileToggle;
  166.             end;
  167.         SetPort(offVirginPort);
  168.         InvertRgn(tileRgns[tileLit, tileToggle]);
  169.         SetPort(offLoadPort);
  170.  
  171.         for index := 0 to 7 do
  172.             with titleLetters[index] do
  173.                 begin
  174.                     velX := velX + forceTable[posX div 1000, posZ div 1000, 0];
  175.                     velZ := velZ + forceTable[posX div 1000, posZ div 1000, 1];
  176.                     posX := posX + velX;
  177.                     posZ := posZ + velZ;
  178.                     screenH := centerH + posX div 100;
  179.                     HLock(Handle(vertTable));
  180.                     screenV := vertTable^^.data[ABS(posX div 300), posZ div 300] + 20;
  181.                     HUnlock(Handle(vertTable));
  182.                     if index = 0 then
  183.                         SetRect(dest, screenH - 14, screenV - 33, screenH + 14, screenV)
  184.                     else
  185.                         SetRect(dest, screenH - 13, screenV - 25, screenH + 13, screenV);
  186.                     UnionRect(oldDest, dest, mask);
  187.                     CopyBits(offVirginMap, offLoadMap, mask, mask, srcCopy, nil);
  188.                 end;
  189.  
  190.         for index := 0 to 7 do
  191.             with titleLetters[index] do
  192.                 begin
  193.                     CopyMask(offPlayerMap, offPlayerMap, offLoadMap, titleSrc[index], titleMask[index], dest);
  194.                 end;
  195.  
  196.         SetPort(mainWndo);
  197.         InvertRgn(tileRgns[tileLit, tileToggle]);
  198.         SetPort(offVirginPort);
  199.  
  200.         for index := 0 to 7 do
  201.             with titleLetters[index] do
  202.                 begin
  203.                     CopyBits(offLoadMap, mainWndo^.portBits, mask, mask, srcCopy, mainWndo^.visRgn);
  204.                     oldDest := dest;
  205.                 end;
  206.     end;
  207.  
  208. {________________________________}
  209.  
  210.     procedure UpDateMainWndo;
  211.         var
  212.             leftEdge, topEdge, rightEdge, bottomEdge: Integer;
  213.             tempRect: Rect;
  214.     begin
  215.         SetPort(mainWndo);
  216.         SetRect(tempRect, -rightOffset, -downOffset, 512 + rightOffset, 342 + downOffset);
  217.         ClipRect(tempRect);
  218.         leftEdge := mainWndo^.portBits.bounds.left;
  219.         topEdge := mainWndo^.portBits.bounds.top;
  220.         rightEdge := mainWndo^.portBits.bounds.right;
  221.         bottomEdge := mainWndo^.portBits.bounds.bottom;
  222.         SetRect(tempRect, leftEdge, topEdge, 0, bottomEdge);
  223.         FillRect(tempRect, black);
  224.         SetRect(tempRect, 512, topEdge, rightEdge, bottomEdge);
  225.         FillRect(tempRect, black);
  226.         SetRect(tempRect, 0, topEdge, 512, 0);
  227.         FillRect(tempRect, black);
  228.         SetRect(tempRect, 0, 342, 512, bottomEdge);
  229.         FillRect(tempRect, black);
  230.         SetRect(tempRect, 0, 0, 512, 342);
  231.         CopyBits(offVirginMap, mainWndo^.portBits, tempRect, tempRect, srcCopy, wholeRgn);
  232.  
  233.         PenNormal;
  234.         InsetRect(tempRect, -1, -1);
  235.         ForeColor(redColor);
  236.         FrameRect(tempRect);
  237.         ForeColor(blackColor);
  238.  
  239.         ClipRect(wholeScreen);
  240.         if (not playing) then
  241.             DrawMenuBar;
  242.         SetPort(offVirginPort);
  243.     end;
  244.  
  245. {________________________________}
  246.  
  247.     procedure InitToolBox;
  248.         var
  249.             index: Integer;
  250.             ignore: Boolean;
  251.     begin
  252.         SetApplLimit(Ptr(LongInt(GetApplLimit) - StackSize));
  253.         MaxApplZone;
  254.         for index := 1 to 12 do
  255.             MoreMasters;
  256.         InitGraf(@thePort);
  257.         InitFonts;
  258.         FlushEvents(everyEvent, 0);
  259.         InitWindows;
  260.         InitMenus;
  261.         TEInit;
  262.         InitDialogs(nil);
  263.  
  264.         ErrorSound(@DoErrorSound);
  265.  
  266.         for index := 1 to 3 do
  267.             ignore := EventAvail(EveryEvent, theEvent);
  268.         inBackground := FALSE;
  269.     end;
  270.  
  271. {________________________________}
  272.  
  273.  
  274.     procedure CloseUpShop;
  275.         var
  276.             index: Integer;
  277.             err: OSErr;
  278.     begin
  279.         ShowMenuBar;
  280.  
  281.         DisposHandle(Handle(vertTable));
  282.  
  283.         DisposeRgn(ballVisRgn);
  284.         DisposeRgn(wholeRgn);
  285.  
  286.         for index := 0 to 5 do
  287.             begin
  288.                 DisposeRgn(tileRgns[index, 0]);
  289.                 DisposeRgn(tileRgns[index, 1]);
  290.             end;
  291.  
  292.         if (chanPtr <> nil) then
  293.             err := SndDisposeChannel(chanPtr, TRUE);
  294.  
  295.         ClosePort(offPlayerPort);
  296.         DisposPtr(Ptr(offPlayerPort));
  297.         ClosePort(offLoadPort);
  298.         DisposPtr(Ptr(offLoadPort));
  299.         ClosePort(offVirginPort);
  300.         DisposPtr(Ptr(offVirginPort));
  301.  
  302.         WriteOutScores;
  303.  
  304.         DisposeWindow(mainWndo);
  305.         mainWndo := nil;
  306.     end;
  307.  
  308. {________________________________}
  309.  
  310.     procedure DoMouseDown;
  311.         var
  312.             code, theMenu, theItem: Integer;
  313.             whichWindow: WindowPtr;
  314.             mResult: LongInt;
  315.     begin
  316.         code := FindWindow(theEvent.where, whichWindow);
  317.         if (code = inMenuBar) then
  318.             begin
  319.                 mResult := MenuSelect(theEvent.Where);
  320.                 theMenu := HiWord(mResult);
  321.                 theItem := LoWord(mResult);
  322.                 Handle_My_Menu(theMenu, theItem);
  323.             end;
  324.         if (code = inSysWindow) then
  325.             SystemClick(theEvent, whichWindow);
  326.     end;
  327.  
  328. {________________________________}
  329.  
  330.     procedure DoKeyDown;
  331.         var
  332.             theChar: Char;
  333.             theMenu, theItem: Integer;
  334.             mResult: LongInt;
  335.     begin
  336.         with theEvent do
  337.             begin
  338.                 theChar := CHR(BitAnd(message, CharCodeMask));
  339.                 if (Odd(modifiers div CmdKey)) then
  340.                     begin
  341.                         mResult := MenuKey(theChar);
  342.                         theMenu := HiWord(mResult);
  343.                         theItem := LoWord(mResult);
  344.                         if (theMenu <> 0) then
  345.                             Handle_My_Menu(theMenu, theItem);
  346.                     end;
  347.             end;
  348.     end;
  349.  
  350. {________________________________}
  351.  
  352.     procedure DoUpdates;
  353.         var
  354.             whichWindow: WindowPtr;
  355.     begin
  356.         whichWindow := WindowPtr(theEvent.message);
  357.         BeginUpdate(whichWindow);
  358.         UpDateMainWndo;
  359.         EndUpdate(whichWindow);
  360.     end;
  361.  
  362. {________________________________}
  363.  
  364.     procedure DoDiskEvent;
  365.         var
  366.             cornerPt: Point;
  367.             theErr: OSErr;
  368.     begin
  369.         if (HiWrd(theEvent.message) <> noErr) then
  370.             begin
  371.                 SetPt(cornerPt, 85 + rightOffset, 50 + downOffset);
  372.                 theErr := DIBadMount(cornerPt, theEvent.message);
  373.             end;
  374.     end;
  375.  
  376. {________________________________}
  377.  
  378.     procedure DoOSEvent;
  379.         var
  380.             theErr: OSErr;
  381.     begin
  382.         case BSR(theEvent.message, 24) of    {high byte of message}
  383.  
  384.             1:                          {suspendResumeMessage}
  385.                 if (BitAnd(theEvent.message, suspendResumeBit) = resuming) then
  386.                     begin
  387.                         if (playing) then
  388.                             HideMenuBar;
  389.                         inBackground := FALSE;        {it was a resume event}
  390.                     end
  391.                 else
  392.                     begin
  393.                         inBackground := TRUE;        {it was a suspend event}
  394.                         if (chanPtr <> nil) then
  395.                             theErr := SndDisposeChannel(chanPtr, TRUE);
  396.                         chanPtr := nil;
  397.                         ShowMenuBar;
  398.                     end;
  399.             otherwise
  400.                 ;
  401.         end; {CASE}
  402.     end; {osEvt}
  403.  
  404. {________________________________}
  405.  
  406.     procedure TwinkleStars;
  407.         var
  408.             i: Integer;
  409.     begin
  410.         SetPort(mainWndo);
  411.         PenMode(patXOr);
  412.         for i := 0 to numberOfStars do
  413.             begin
  414.                 tempInt := DoRandom(45);
  415.                 MoveTo(stars[tempInt, 0], stars[tempInt, 1]);
  416.                 Line(0, 0);
  417.             end;
  418.         PenMode(patCopy);
  419.         SetPort(offLoadPort);
  420.  
  421.         if (TickCount < lastLoopTime) then
  422.             begin
  423.                 if (numberOfStars < 33) then
  424.                     numberOfStars := numberOfStars + 2;
  425.             end
  426.         else if (numberOfStars > 0) then
  427.             numberOfStars := numberOfStars div 2;
  428.     end;
  429.  
  430. {________________________________}
  431.  
  432.     procedure HandlePlayLoop;
  433.         var
  434.             dummyLong, tempTime: longint;
  435.             tempInt: integer;
  436.             theInput: TEHandle;
  437.             theKeys: KeyMap;
  438.  
  439. {---------------}
  440.  
  441.         procedure HandlePracticeSkating;
  442.         begin
  443.             Delay(1, dummyLong);
  444.             WheresMouse;
  445.             if (player.timeKeeper < 0) then
  446.                 PlayerInTransit
  447.             else
  448.                 NewPlayerPosition;
  449.             DrawPlayer;
  450.         end;
  451.  
  452. {---------------}
  453.  
  454.         procedure HandlePracticeBall;
  455.         begin
  456.             Delay(1, dummyLong);
  457.             WheresMouse;
  458.             if (player.timeKeeper < 0) then
  459.                 PlayerInTransit
  460.             else
  461.                 NewPlayerPosition;
  462.             if (ball.timeKeeper < 0) then
  463.                 BallInTransit
  464.             else
  465.                 NewBallPosition;
  466.             DrawPlayerAndBall;
  467.         end;
  468.  
  469. {---------------}
  470.  
  471.         procedure HandlePeriodGames;
  472.         begin
  473.             tempTime := periodTime - LapsedTime;
  474.             if (tempTime < 0) then
  475.                 begin
  476.                     ResetArrows;
  477.                     EndOfPeriod;
  478.                 end
  479.             else
  480.                 DisplayTime(tempTime);
  481.  
  482.             WheresMouse;
  483.  
  484.             if (player.timeKeeper < 0) then
  485.                 PlayerInTransit
  486.             else
  487.                 NewPlayerPosition;
  488.  
  489.             if (opponent.timeKeeper < 0) then
  490.                 OpponentInTransit
  491.             else
  492.                 NewOpponentPosition;
  493.  
  494.             if (ball.timeKeeper < 0) then
  495.                 BallInTransit
  496.             else
  497.                 NewBallPosition;
  498.  
  499.             if (player.posZ < opponent.posZ) then
  500.                 DrawPlayerOpponent
  501.             else
  502.                 DrawOpponentPlayer;
  503.         end;
  504.  
  505. {---------------}
  506.  
  507.         procedure HandleFirstToThirteen;
  508.         begin
  509.             WheresMouse;
  510.  
  511.             if (player.timeKeeper < 0) then
  512.                 PlayerInTransit
  513.             else
  514.                 NewPlayerPosition;
  515.  
  516.             if (opponent.timeKeeper < 0) then
  517.                 OpponentInTransit
  518.             else
  519.                 NewOpponentPosition;
  520.  
  521.             if (ball.timeKeeper < 0) then
  522.                 BallInTransit
  523.             else
  524.                 NewBallPosition;
  525.  
  526.             if (player.posZ < opponent.posZ) then
  527.                 DrawPlayerOpponent
  528.             else
  529.                 DrawOpponentPlayer;
  530.  
  531.             if ((taygetePoints > 12) or (earthPoints > 12)) then
  532.                 EndOfPeriod;
  533.         end;
  534.  
  535. {---------------}
  536.  
  537.         procedure HandleDeltaFive;
  538.         begin
  539.             WheresMouse;
  540.  
  541.             if (player.timeKeeper < 0) then
  542.                 PlayerInTransit
  543.             else
  544.                 NewPlayerPosition;
  545.  
  546.             if (opponent.timeKeeper < 0) then
  547.                 OpponentInTransit
  548.             else
  549.                 NewOpponentPosition;
  550.  
  551.             if (ball.timeKeeper < 0) then
  552.                 BallInTransit
  553.             else
  554.                 NewBallPosition;
  555.  
  556.             if (player.posZ < opponent.posZ) then
  557.                 DrawPlayerOpponent
  558.             else
  559.                 DrawOpponentPlayer;
  560.  
  561.             if (ABS(taygetePoints - earthPoints) > 4) then
  562.                 EndOfPeriod;
  563.         end;
  564.  
  565. {---------------}
  566.  
  567.         procedure HandlePause;
  568.         begin
  569.             tempTime := TickCount div 60;
  570.             repeat
  571.                 GetKeys(theKeys);
  572.             until (not theKeys[kPauseKey]);
  573.             repeat
  574.                 GetKeys(theKeys);
  575.             until (theKeys[kPauseKey]);
  576.             repeat
  577.                 GetKeys(theKeys);
  578.             until (not theKeys[kPauseKey]);
  579.             periodTime := periodTime + (TickCount div 60 - tempTime);
  580.         end;
  581.  
  582. {---------------}
  583.  
  584.     begin
  585.         case whichGame of
  586.             practiceSkating: 
  587.                 HandlePracticeSkating;
  588.             practiceWBall: 
  589.                 HandlePracticeBall;
  590.             fourOfFive, fourOfNine: 
  591.                 HandlePeriodGames;
  592.             firstToThirteen: 
  593.                 HandleFirstToThirteen;
  594.             deltaFive: 
  595.                 HandleDeltaFive;
  596.             otherwise
  597.         end;
  598.  
  599.         GetKeys(theKeys);
  600.  
  601.         if ((theKeys[$37]) and (theKeys[$0E])) then
  602.             begin
  603.                 if AbortGame then
  604.                     Handle_My_Menu(mGame, iEnd)
  605.                 else
  606.                     ReturnToGame;
  607.             end;
  608.  
  609.         if ((theKeys[$37]) and (theKeys[$0C])) then
  610.             begin
  611.                 if AbortGame then
  612.                     Handle_My_Menu(mGame, iQuit)
  613.                 else
  614.                     ReturnToGame;
  615.             end;
  616.  
  617.         if (theKeys[kPauseKey]) then
  618.             HandlePause;
  619.  
  620.         TwinkleStars;
  621.  
  622.         if (not cursorVis) then
  623.             HideCursor;
  624.  
  625.         repeat
  626.         until (TickCount >= lastLoopTime);
  627.         lastLoopTime := TickCount + delayTime;
  628.  
  629.     end;
  630.  
  631. {________________________________}
  632.  
  633. {$I-}
  634. begin
  635.     InitToolBox;
  636.     OpenLogo;
  637.  
  638.     InitVariables;
  639.     ResetTitleVars;
  640.     UnloadSeg(@InitVariables);
  641.     CloseLogo;
  642.     InitCursor;
  643.  
  644.     repeat
  645.  
  646.         if (hasWNE) then
  647.             eventHappened := WaitNextEvent(everyEvent, theEvent, sleep, nil)
  648.         else
  649.             begin
  650.                 SystemTask;
  651.                 eventHappened := GetNextEvent(everyEvent, theEvent);
  652.             end;
  653.  
  654.         if (eventHappened) then
  655.             case theEvent.what of
  656.                 MouseDown: 
  657.                     DoMouseDown;
  658.                 KeyDown: 
  659.                     DoKeyDown;
  660.                 UpDateEvt: 
  661.                     DoUpdates;
  662.                 DiskEvt: 
  663.                     DoDiskEvent;
  664.                 App4Evt: 
  665.                     DoOSEvent;
  666.                 otherwise
  667.             end;
  668.  
  669.         while (playing) do
  670.             HandlePlayLoop;
  671.  
  672.         if (justQuit) then
  673.             begin
  674.                 if (tileLit <> -1) then
  675.                     begin
  676.                         SetPort(offVirginPort);
  677.                         InvertRgn(tileRgns[tileLit, tileToggle]);
  678.                         tileLit := -1;
  679.                     end;
  680.                 CopyBits(offVirginMap, mainWndo^.portBits, wholeScreen, wholeScreen, srcCopy, wholeRgn);
  681.                 CopyBits(offVirginMap, offLoadMap, wholeScreen, wholeScreen, srcCopy, nil);
  682.                 justQuit := FALSE;
  683.                 InitCursor;
  684.                 DrawMenuBar;
  685.             end;
  686.  
  687.         if ((not inBackground) and (not pausing) and (mainWndo = FrontWindow)) then
  688.             begin
  689.                 TwinkleStars;
  690.                 numberOfStars := 4;
  691.                 DoOpeningAnimation;
  692.                 if (jetsOut) then
  693.                     DoJets
  694.                 else
  695.                     begin
  696.                         tempInt := DoRandom(1000);
  697.                         if (tempInt = 0) then
  698.                             begin
  699.                                 jetsOut := TRUE;
  700.                                 SetRect(jetsRects[2], -72, 275, 0, 325);
  701.                             end;
  702.                     end;
  703.             end;
  704.  
  705.     until doneFlag;                       {End of the event loop}
  706.  
  707.     CloseUpShop;
  708.  
  709. end.                                    {End of the program}